﻿<%@ Page Language="C#" MasterPageFile="~/Admin.Master" AutoEventWireup="true" CodeBehind="RelativeList.aspx.cs"
    Inherits="VCN.admin.RelativeList" %>

<asp:Content ID="Content23" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table width="100%" cellspacing="3" cellpadding="3" border="0">
        <tbody>
            <tr>
                <th scope="col" class="title" colspan="2">
                    <h2 style="color: #00CCFF; font-size: x-large; text-align: left;">
                        QUẢN L<span style="background-color: #FFFFFF">Ý SẢN PHẨM LIÊN QUAN</span></h2>
                </th>
            </tr>
            <tr>
                <td colspan="2" class="row" align="center" style="height: 5px">
                    &nbsp;</td>
            </tr>
            <tr>
                <td 
                    
                    style="height: 32px; color: #0099FF; width: 18%; font-weight: bold;">
                                        Tên loại sản phẩm&nbsp;&nbsp;
                </td>
                <td width="46%" align="left" class="row" style="height: 32px; width: 70%;">
                    <asp:DropDownList ID="ddl_CategoryName" runat="server" Width="173px" 
                        OnSelectedIndexChanged="ddl_Category_SelectedIndexChanged" 
                        AutoPostBack="True">
                    </asp:DropDownList>
                    <asp:Label ID="lbl_Id" runat="server" Text="Label" Visible="False"></asp:Label>
                    <asp:Label ID="lbl_trang_thai_update" runat="server" Text="Label" 
                        Visible="False"></asp:Label>
                </td>
            </tr>
            <tr>
                <td 
                    
                    style="height: 32px; color: #0099FF; width: 18%; font-weight: bold;">
                                        Tên sản phẩm&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;                 </td>
                <td width="46%" align="left" class="row" style="height: 32px; width: 70%;">
                    <asp:DropDownList ID="ddl_ProductName" runat="server" Width="173px" 
                        onselectedindexchanged="ddl_ProductName_SelectedIndexChanged" AutoPostBack="true">
                    </asp:DropDownList>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                        ControlToValidate="ddl_Product">(*) Không có tên sản phẩm nào được chọn</asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
            <td class="row" 
                    style="height: 32px; width: 18%; color: #0099FF; text-align: left; font-weight: bold;">
                                        Tên SP liên quan&nbsp;&nbsp;&nbsp; </td>
                <td width="46%" align="left" class="row" style="height: 32px; width: 70%;">
                    <asp:TextBox ID="m_txt_RelativeProductName" runat="server" Width="170px"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                        ControlToValidate="m_txt_RelativeProductName">(*) Chưa nhập tên SP liên quan</asp:RequiredFieldValidator>
                    
                </td>
            </tr>
            <tr>
                <td 
                    
                    style="height: 32px; color: #0099FF; width: 18%; font-weight: bold;">
                                        Ảnh sản phẩm&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                </td>
                <td width="46%" align="left" class="row" style="height: 32px; width: 70%;">
                    <br />
                    <br />
                    <asp:Image ID="imgPreview" runat="server" Height="150px" Width="150px" AlternateText="No Image"
                        ImageUrl="~/admin/img/no_images.jpg" />
                    <br />
                    <br />
                    <asp:FileUpload ID="FileUpload" runat="server" ToolTip="Click here to upload an image for product." />
                    <asp:Label ID="lbl_Error" runat="server" Font-Bold="False" ForeColor="Red" 
                        Text="(*) Phải chọn ảnh sản phẩm" Visible="False"></asp:Label>
                    <br />
                    <br />
                </td>
            </tr>
            <tr>
                <td height="43" align="right" class="save" 
                    style="width: 18%; font-weight: bold;">
                    &nbsp;
                </td>
                <td height="43" align="left">
                    &nbsp;<asp:Button ID="btnAdd" runat="server" Text="Thêm mới" 
                        OnClick="btnAdd_click" />
                    &nbsp;&nbsp;<asp:Button ID="btnUp" runat="server" Text="Cập nhật" CausesValidation="False"
                        OnClick="btnUpdate_click" />
                &nbsp;<asp:Button ID="btnReset" runat="server" Text="Xóa trắng" OnClick="btnReset_Click"
                        CausesValidation="False" />
                </td>
            </tr>
        </tbody>
    </table>

    <table width="100%" style="margin-top: 15px">
        <tr>
            <td colspan="2">
                <h2 style="text-align: left; color: #00CCFF; font-size: x-large; background-color: #FFFFFF;">
                    DANH SÁCH SẢN PHẨM LIÊN QUAN</h2>
            </td>
        </tr>
        <tr>
            <td style="width: 93px; color: #0099FF">
                <b>Loại sản phẩm&nbsp; :</b>
            </td>
            <td>
                <asp:DropDownList ID="ddl_Category" runat="server" OnSelectedIndexChanged="ddl_CategoryLoc_SelectedIndexChanged"
                    Width="169px" AutoPostBack="true">
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td style="width: 93px; color: #0099FF">
                <b>Sản phẩm&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :</b>
            </td>
            <td>
                <asp:DropDownList ID="ddl_Product" runat="server" OnSelectedIndexChanged="ddl_ProductLoc_SelectedIndexChanged"
                    Width="169px" AutoPostBack="true">
                </asp:DropDownList>
            </td>
        </tr>
    </table>
    <br />
    <asp:Label ID="m_lbl_mess" runat="server" ForeColor="Red" Text="Message :" 
    Visible="False" style="text-align: left"></asp:Label>
    <br />
    <asp:GridView ID="dgv_RelativeProduct" runat="server" CellPadding="4" ForeColor="#333333"
        Width="100%" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="ID"
        OnRowDeleting="gridRelativeImage_Delete" OnRowEditing="gridRelativeImage_Edit"
        BorderColor="#1C5E55" BorderStyle="Solid" OnPageIndexChanging="dgv_RelativeProduct_PageIndexChanging">
        <RowStyle BackColor="#E3EAEB" />
        <Columns>
            <asp:TemplateField HeaderText="STT">
                <ItemTemplate>
                    <%# Container.DataItemIndex + 1 %></ItemTemplate>
                <ItemStyle Width="5%" />
            </asp:TemplateField>
            <asp:BoundField DataField="RELATIVE_PRODUCT_NAME" HeaderText="Tên SP liên quan" />
            <asp:ImageField DataImageUrlField="RELATIVE_PRODUCT_IMAGE" DataImageUrlFormatString="../Images/Product/{0}"
                HeaderText="Image" ControlStyle-Width="70px" ControlStyle-Height="50px">
                <ControlStyle Height="50px" Width="70px"></ControlStyle>
            </asp:ImageField>
            <asp:TemplateField HeaderText="Sản phẩm">
                <ItemTemplate>
                    <%# GetProductName(Eval("PRODUCT_ID")) %>
                </ItemTemplate>
                <ItemStyle Width="20%" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Sửa" >
                <ItemTemplate>
                    <asp:LinkButton ID="lbtnEdit" runat="server" Text="Edit" CommandName="Edit" CausesValidation="false"><img title="Sửa" src="img/edit.png" alt="Edit"/></asp:LinkButton>
                </ItemTemplate>
                <ItemStyle Width="5%" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Xóa">
                <ItemTemplate>
                    <asp:LinkButton ID="lbtnDelete" runat="server" Text="Delete" CommandName="Delete" CausesValidation="false"
                        OnClientClick="return confirm('Bạn có chắc rằng bạn muốn xóa ?');"><img title="Xóa" src="img/deletered.png" alt="Delete" /></asp:LinkButton>
                </ItemTemplate>
                <ItemStyle Width="5%" />
            </asp:TemplateField>
        </Columns>
        <FooterStyle BackColor="#0099FF" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
        <HeaderStyle BackColor="#0099FF" Font-Bold="True" ForeColor="White" />
        <EditRowStyle BackColor="#7C6F57" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
</asp:Content>
